package com.yuanlrc.base.entity.admin;


import com.yuanlrc.base.annotion.ValidateEntity;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 班级列表实体类
 *
 */
@Entity
@Table(name="ylrc_clazz")
@EntityListeners(AuditingEntityListener.class)
public class Clazz extends BaseEntity {

    // 班级编号 班级名称 所属学院 班主任 班主任电话
    @ValidateEntity(required=true,requiredLeng=true,minLength=2,maxLength=2,errorRequiredMsg="班级编号不能为空!",errorMinLengthMsg="班级编号只能写两位!",errorMaxLengthMsg="班级编号只能写两位!")
    @Column(name="num",nullable=false,length=2)
    private String num;    //编号

    @ValidateEntity(required=true,requiredLeng=true,minLength=2,maxLength=10,errorRequiredMsg="班级名称不能为空!",errorMinLengthMsg="班级名称至少填写两个!",errorMaxLengthMsg="班级名称最多填写十个!")
    @Column(name="name",nullable=false,length=10)
    private String name;   //名称

    @ManyToOne
    @JoinColumn(name="faculties_id")
    private Faculties faculties; //所属学院

    @ValidateEntity(required=true,requiredLeng=true,minLength=2,maxLength=10,errorRequiredMsg="名字不能为空!",errorMinLengthMsg="名字过短!",errorMaxLengthMsg="名字过长!")
    @Column(name="teacher",nullable=false,length=10)
    private String teacher;   //班主任

    @ValidateEntity(required=true,requiredLeng=true,minLength=11,maxLength=11,errorRequiredMsg="电话不能为空!",errorMinLengthMsg="请填写11位电话!",errorMaxLengthMsg="请填写11位电话")
    @Column(name="telephone",nullable=false,length=11)
    private String telephone;   //班主任电话

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Faculties getFaculties() {
        return faculties;
    }

    public void setFaculties(Faculties faculties) {
        this.faculties = faculties;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Override
    public String toString() {
        return "Clazz{" +
                "num='" + num + '\'' +
                ", name='" + name + '\'' +
                ", faculties=" + faculties +
                ", teacher='" + teacher + '\'' +
                ", telephone='" + telephone + '\'' +
                '}';
    }
}
